<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateProductSpecsAttrsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('product_specs_attrs')) {
            Schema::create('product_specs_attrs', function (Blueprint $table) {
                $table->id();
                $table->integer('product_id')->comment('商品ID:product_bases.id');
                $table->string('name')->comment('属性名称');
                $table->string('value')->comment('属性值');
                $table->softDeletes();
                $table->timestamps();
            });
            DB::statement("ALTER TABLE `product_specs_attrs` comment '商品规格属性表'");
        }
        // INSERT INTO `release_apis`.`product_specs_attrs` (`id`, `product_id`, `name`, `value`, `deleted_at`, `created_at`, `updated_at`) VALUES ('227', '85', 'type', '10目', NULL, '2023-11-29 11:25:13', '2023-11-29 11:25:13');
        // INSERT INTO `release_apis`.`product_specs_attrs` (`id`, `product_id`, `name`, `value`, `deleted_at`, `created_at`, `updated_at`) VALUES ('228', '85', 'type', '20目', NULL, '2023-11-29 11:25:13', '2023-11-29 11:25:13');
        // INSERT INTO `release_apis`.`product_specs_attrs` (`id`, `product_id`, `name`, `value`, `deleted_at`, `created_at`, `updated_at`) VALUES ('229', '85', 'standards', '10kg', NULL, '2023-11-29 11:25:13', '2023-11-29 11:25:13');
        // INSERT INTO `release_apis`.`product_specs_attrs` (`id`, `product_id`, `name`, `value`, `deleted_at`, `created_at`, `updated_at`) VALUES ('230', '85', 'standards', '20kg', NULL, '2023-11-29 11:25:13', '2023-11-29 11:25:13');

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_specs_attrs');
    }
}
